<template>
	<view class="container">
		<view class="banner">
			<image src="../../static/images/index/index.jpg" ></image>
			<view class="intro">
				<view v-if="isLogin" class="greet">您好，{{userInfo.name}}</view>
				<view v-else class="greet">您好，游客</view>
				<view class="note">一杯奶茶，一口软欧包，在奈雪遇见两种美好</view>
			</view>
		</view>
		<view class="content">
			<view class="entrance">
				<view class="item" @tap="takein">
					<u--image :showLoading="true" src="/static/images/index/zq.png" width="84rpx" height="84rpx" class="icon" ></u--image>
					<view class="title">自取</view>
				</view>
				<view class="item" @tap="takeout">
					<u--image :showLoading="true" src="/static/images/index/wm.png" width="84rpx" height="84rpx" class="icon" ></u--image>
					<view class="title">外卖</view>
				</view>
			</view>
			<view class="info">
				<view class="integral_section" @tap="integrals">
					<view class="top">
						<text class="title">我的积分</text>
						<text class="value">411</text>
					</view>
					<view class="bottom">
						进入积分商城兑换奈雪券及周边好礼
						<u-icon name="arrow-right" size="24rpx"></u-icon>
					</view>
				</view>
				<view class="qrcode_section" @tap="memberCode">
					<u--image :showLoading="true" src="/static/images/index/qrcode.png" width="40rpx" height="40rpx" class="icon" ></u--image>
					<text>会员码</text>
				</view>
			</view>
			<view class="navigators">
				<view class="left">
					<view class="l_top">
						<view class="text">
							<u--image :showLoading="true" src="/static/images/index/csc.png" width="32rpx" height="32rpx" class="mark-img" ></u--image>
							<view class="text_style">奈雪的茶商城</view>
						</view>
						<view class="text_color_assist">优质茶礼盒，网红零食</view>
					</view>
					<view class="l_bottom">
						<u--image :showLoading="true" src="/static/images/index/yzclh.png" width="228rpx" height="130rpx" class="yzclh-img" ></u--image>
					</view>
				</view>
				<view class="right">
					<view class="tea_activity">
						<u--image :showLoading="true" src="/static/images/index/mcsb.png" width="32rpx" height="32rpx" class="left_img" ></u--image>
						<view class="tea_title">买茶送包</view>
						<view class="right_img">
							<u--image :showLoading="true" src="/static/images/index/mcsb_bg.png" width="130rpx" height="116rpx" ></u--image>
						</view>
					</view>
					<view class="tea_activity tea_activity_copy">
						<u--image :showLoading="true" src="/static/images/index/hyjb.png" width="32rpx" height="32rpx" class="left_img" ></u--image>
						<view class="tea_title">会员劵包</view>
						<view class="right_img">
							<u--image :showLoading="true" src="/static/images/index/hyjb_bg.png" width="130rpx" height="116rpx" ></u--image>
						</view>
					</view>
				</view>
			</view>
			<view class="member-news">
				<view class="header">
					<view class="title">会员新鲜事</view>
					<view class="icon_style">
						<u-icon name="arrow-right" color="#919293" size="20"></u-icon>
					</view>
				</view>
				<view class="list">
					<view class="item">
						<u--image :showLoading="true" src="https://img-shop.qmimg.cn/s23107/2020/04/27/0039bf41c9ebd50a2c.jpg" width="710rpx" height="256rpx" ></u--image>
						<view class="title">"梅"你不行 | 霸气杨梅清爽回归</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
		import { mapActions,mapState } from 'vuex';
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {

		},
		computed:{
			...mapState('user',['isLogin','userInfo'])
		},
		methods: {
			// 外卖
			takeout(){
				uni.navigateTo({
					url:'/subpackage/address/address'
				})
			},
			// 自取
			takein(){
				uni.switchTab({
					url:'/pages/menu/menu'
				})
			}
		}
	}
</script>

<style lang="scss">
	.container {
		.banner{
			position: relative;
			width:750rpx;
			height:538rpx;
			image{
				width:750rpx;
				height:538rpx
			}
			.intro{
				position: absolute;
				top: 40rpx;
				left: 20px;
				color: #FFFFFF;
				width: 480rpx;
				height: 84rpx;
				.greet{
					font-size: 16px;
					margin-bottom: 5px;
				}
				.note{
					font-size: 12px;
				}
			}
		}
		.content{
			position: relative;
			background-color: #f1f8fa;
			width: 100%;
			height: 1150rpx;
			.entrance{
				display: flex;
				position: absolute;
				align-items: center;
				top: -80rpx;
				left: 20rpx;
				width: 710rpx;
				height: 250rpx;
				border-radius: 20rpx;
				background-color: #fff;
				.item{
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;
					width: 370rpx;
					height: 150rpx;
					box-sizing: border-box;
					.icon{
						margin: 10rpx;
					}
					.title{
						font-size: 15px;
						color: #5A5B5C;
						font-weight: 600;
					}
					
				}
			}
			.info{
				position: absolute;
				top: 200rpx;
				left: 20rpx;
				border-radius: 20rpx;
				width: 710rpx;
				height: 150rpx;
				background-color: #ffffff;
				box-shadow: 0 10px 10px -10px rgba(51, 51, 51, 0.1);
				padding: 30rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				box-sizing: border-box;
				.integral_section{
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: center;
					.top {
						display: flex;
						align-items: center;
						
						.title {
							margin-right: 10rpx;
						}
						.value {
							font-size: 44rpx;
							font-weight: bold;
						}
					}
					.bottom{
						font-size: 12px;
						color: #919293;
						display: flex;
						align-items: center;
					}
				}
				.qrcode_section{
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					color: #ADB838;
					font-size: 12px;
					
					.icon {
						margin-bottom: 10rpx;
					}
				}
			}
			.navigators{
				display: flex;
				align-items: center;
				justify-content: space-around;
				position: absolute;
				top: 390rpx;
				left: 20rpx;
				width: 710rpx;
				height: 300rpx;
				border-radius: 20rpx;
				background-color: #fff;
				.left{
					display: flex;
					flex-direction: column;
					align-items: center;
					width: 350rpx;
					height: 270rpx;
					background-color: #F2F2E6;
					.l_top{
						display: flex;
						flex-direction: column;
						justify-content: center;
						align-items: flex-start;
						width: 310rpx;
						height: 146rpx;
						.text{
							display: flex;
							.text_style{
								color: #5A5B5C;
								font-size: 24rpx;
							}
						}
						.text_color_assist{
							margin-left: 42rpx;
							font-size: 10rpx;
							color: #919293;
						}
					}
				}
				.right{
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					width: 308rpx;
					height: 270rpx;
					.tea_activity{
						display: flex;
						align-items: center;
						justify-content: space-evenly;
						width: 308rpx;
						height: 125rpx;
						background-color: #FDF3F2;
						.tea_title{
							font-size: 12px;
							color: #5A5B5C;
						}
					}
					.tea_activity_copy{
						background-color: #FCF6D4;
					}
				}
			}
			.member-news {
				position: absolute;
				top: 720rpx;
				left: 20rpx;
				width: 710rpx;
				margin-bottom: 30rpx;
				.header {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 20rpx 0;
					
					.title {
						font-weight: bold;
					}
					
					.icon_style {
						width: 40rpx;
						height: 40rpx;
						border-radius: 50%;
						border: 5rpx solid #919293;
					}
				}
				
				.list {
					width: 100%;
					display: flex;
					flex-direction: column;
					
					.item {
						width: 100%;
						height: 240rpx;
						position: relative;
						
						image {
							width: 100%;
							height: 100%;
							border-radius: 8rpx;
						}
						
						.title {
							position: relative;
							font-size: 32rpx;
							font-weight: 500;
							width: 100%;
							top: -70rpx;
							left: 16rpx;
							color: #ffffff;
						}
					}
				}
			}
		}
	}
</style>
